package job.work.utils;

/**
 * @author zzy
 * @Classname StringUtils
 * @Date 2020/10/26 19:26
 * @Created by Administrator
 */


public class VarcharUtils {

    private static final long serialVersionUID = 1L;

    /*
     * 字符串截小时 转换Integer型
     * */
    public static Integer cutOut(String word,Integer size){
        String strh =
                word.substring(word.length()-size,word.length());
        Integer integer = Integer.valueOf(strh);
        return integer;
    }


    /*
    * 字符串截取年/月/日
    * */
    public static Integer cutOuts(String word,Integer size){
        int i = word.lastIndexOf(" ");
        String substring = word.substring(0,i);
        String[] split = substring.split("-");
        String newWord = null;
        for(int a=0;a<split.length;a++){
            if(a == size){
                newWord = split[a];
            }
        }
        Integer integer = Integer.valueOf(newWord);
        return integer;
    }



}
